/*
 * @lc app=leetcode.cn id=1051 lang=cpp
 *
 * [1051] 高度检查器
 */

// @lc code=start
class Solution {
public:
    int heightChecker(vector<int>& heights) {
        auto v = heights;
        sort(v.begin(), v.end());
        int ans = 0;
        for(int i = 0 ; i < v.size(); i++)
        {
            if(v[i] != heights[i])
            {
                ans++;
            }
        }
        return ans;
    }
};
// @lc code=end

